<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>转义元字符集</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.quoted-printable-encode.html">« quoted_printable_encode</a></li>
      <li style="float: right;"><a href="function.rtrim.html">rtrim »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.strings.html">字符串 函数</a></li>
    <li>转义元字符集</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.quotemeta" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">quotemeta</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">quotemeta</span> &mdash; <span class="dc-title">转义元字符集</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.quotemeta-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>quotemeta</strong></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$string</code></span>): <span class="type">string</span></div>

  <p class="para rdfs-comment">
   返回 在下面这些特殊字符前加 反斜线(<code class="literal">\</code>) 转义后的字符串。
   这些特殊字符包含：
   <div class="example-contents screen">. \ + * ? [ ^ ] ( $ )</div>
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.quotemeta-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">string</code></dt>

     <dd>

      <p class="para">
       输入字符串
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.quotemeta-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回 元字符集被转义后的 字符串，如果输入字符串<code class="parameter">string</code>为空，
   则返回 <strong><code>false</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.quotemeta-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-4803">
    <p><strong>示例 #1 <span class="function"><strong>quotemeta()</strong></span> 示例</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">quotemeta</span><span style="color: #007700">(</span><span style="color: #DD0000">'PHP&nbsp;is&nbsp;a&nbsp;popular&nbsp;scripting&nbsp;language.&nbsp;Fast,&nbsp;flexible,&nbsp;and&nbsp;pragmatic.'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
string(69) &quot;PHP is a popular scripting language\. Fast, flexible, and pragmatic\.&quot;
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.quotemeta-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">注意</strong>: <span class="simpara">此函数可安全用于二进制对象。</span></p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.quotemeta-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.addslashes.html" class="function" rel="rdfs-seeAlso">addslashes()</a> - 使用反斜线引用字符串</span></li>
    <li class="member"><span class="function"><a href="function.addcslashes.html" class="function" rel="rdfs-seeAlso">addcslashes()</a> - 以 C 语言风格使用反斜线转义字符串中的字符</span></li>
    <li class="member"><span class="function"><a href="function.htmlentities.html" class="function" rel="rdfs-seeAlso">htmlentities()</a> - 将字符转换为 HTML 转义字符</span></li>
    <li class="member"><span class="function"><a href="function.htmlspecialchars.html" class="function" rel="rdfs-seeAlso">htmlspecialchars()</a> - 将特殊字符转换为 HTML 实体</span></li>
    <li class="member"><span class="function"><a href="function.nl2br.html" class="function" rel="rdfs-seeAlso">nl2br()</a> - 在字符串所有新行之前插入 HTML 换行标记</span></li>
    <li class="member"><span class="function"><a href="function.stripslashes.html" class="function" rel="rdfs-seeAlso">stripslashes()</a> - 反引用一个引用字符串</span></li>
    <li class="member"><span class="function"><a href="function.stripcslashes.html" class="function" rel="rdfs-seeAlso">stripcslashes()</a> - 反引用一个使用 addcslashes 转义的字符串</span></li>
    <li class="member"><span class="function"><a href="function.preg-quote.html" class="function" rel="rdfs-seeAlso">preg_quote()</a> - 转义正则表达式字符</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>